package c.h.a.x;

import c.h.a.x.r.a;

/* compiled from: OperationUtils */
public final class q implements Runnable {
    public long a;
    public long b;
    public final /* synthetic */ String c;
    public final /* synthetic */ a d;
    public final /* synthetic */ String e;

    public q(String str, a aVar, String str2) {
        this.c = str;
        this.d = aVar;
        this.e = str2;
    }

    /* JADX WARNING: Missing exception handler attribute for start block: B:53:0x00e7 */
    /* JADX WARNING: Removed duplicated region for block: B:40:0x00b1  */
    /* JADX WARNING: Missing exception handler attribute for start block: B:35:0x00a6 */
    /* JADX WARNING: Removed duplicated region for block: B:88:0x0133 A:{SYNTHETIC, Splitter:B:88:0x0133} */
    /* JADX WARNING: Removed duplicated region for block: B:92:0x0138 A:{SYNTHETIC, Splitter:B:92:0x0138} */
    /* JADX WARNING: Removed duplicated region for block: B:97:0x0143  */
    /* JADX WARNING: Removed duplicated region for block: B:73:0x0117 A:{SYNTHETIC, Splitter:B:73:0x0117} */
    /* JADX WARNING: Removed duplicated region for block: B:77:0x011c A:{SYNTHETIC, Splitter:B:77:0x011c} */
    /* JADX WARNING: Removed duplicated region for block: B:88:0x0133 A:{SYNTHETIC, Splitter:B:88:0x0133} */
    /* JADX WARNING: Removed duplicated region for block: B:92:0x0138 A:{SYNTHETIC, Splitter:B:92:0x0138} */
    /* JADX WARNING: Removed duplicated region for block: B:97:0x0143  */
    /* JADX WARNING: Removed duplicated region for block: B:73:0x0117 A:{SYNTHETIC, Splitter:B:73:0x0117} */
    /* JADX WARNING: Removed duplicated region for block: B:77:0x011c A:{SYNTHETIC, Splitter:B:77:0x011c} */
    /* JADX WARNING: Removed duplicated region for block: B:88:0x0133 A:{SYNTHETIC, Splitter:B:88:0x0133} */
    /* JADX WARNING: Removed duplicated region for block: B:92:0x0138 A:{SYNTHETIC, Splitter:B:92:0x0138} */
    /* JADX WARNING: Removed duplicated region for block: B:97:0x0143  */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Can't wrap try/catch for region: R(9:101|32|33|34|35|36|37|(1:40)|41) */
    /* JADX WARNING: Can't wrap try/catch for region: R(8:100|49|50|51|52|53|54|55) */
    /* JADX WARNING: Missing block: B:57:0x00f0, code skipped:
            if (r14.d.stop() != false) goto L_0x0127;
     */
    /* JADX WARNING: Missing block: B:81:0x0125, code skipped:
            if (r14.d.stop() == false) goto L_0x012a;
     */
    /* JADX WARNING: Missing block: B:82:0x0127, code skipped:
            r2.delete();
     */
    public void run() {
        /*
        r14 = this;
        r0 = new java.io.File;
        r1 = r14.c;
        r0.<init>(r1);
        r1 = r0.exists();
        if (r1 != 0) goto L_0x001b;
    L_0x000d:
        r0 = r14.d;
        r0.getClass();
        r1 = new c.h.a.x.b;
        r1.m2152init(r0);
        c.h.a.m0.p.a.b(r1);
        return;
    L_0x001b:
        r1 = r0.length();
        r14.a = r1;
        r1 = c.h.a.x.r.a;
        r2 = r1.exists();
        if (r2 != 0) goto L_0x003d;
    L_0x0029:
        r2 = r1.mkdirs();
        if (r2 != 0) goto L_0x003d;
    L_0x002f:
        r0 = r14.d;
        r0.getClass();
        r1 = new c.h.a.x.b;
        r1.m2152init(r0);
        c.h.a.m0.p.a.b(r1);
        return;
    L_0x003d:
        r2 = new java.io.File;
        r3 = r14.e;
        r2.<init>(r1, r3);
        r1 = r2.exists();
        if (r1 == 0) goto L_0x0075;
    L_0x004a:
        r3 = r2.length();
        r5 = r14.a;
        r1 = (r3 > r5 ? 1 : (r3 == r5 ? 0 : -1));
        if (r1 != 0) goto L_0x0061;
    L_0x0054:
        r14.b = r5;
        r0 = r14.d;
        r1 = new c.h.a.x.n;
        r1.m2164init(r14, r0);
        c.h.a.m0.p.a.b(r1);
        return;
    L_0x0061:
        r1 = r2.delete();
        if (r1 != 0) goto L_0x0075;
    L_0x0067:
        r0 = r14.d;
        r0.getClass();
        r1 = new c.h.a.x.b;
        r1.m2152init(r0);
        c.h.a.m0.p.a.b(r1);
        return;
    L_0x0075:
        r1 = 0;
        r3 = new java.io.BufferedInputStream;	 Catch:{ IOException -> 0x0102, all -> 0x00fd }
        r4 = new java.io.FileInputStream;	 Catch:{ IOException -> 0x0102, all -> 0x00fd }
        r4.<init>(r0);	 Catch:{ IOException -> 0x0102, all -> 0x00fd }
        r3.<init>(r4);	 Catch:{ IOException -> 0x0102, all -> 0x00fd }
        r0 = new java.io.BufferedOutputStream;	 Catch:{ IOException -> 0x00fa, all -> 0x00f5 }
        r4 = new java.io.FileOutputStream;	 Catch:{ IOException -> 0x00fa, all -> 0x00f5 }
        r4.<init>(r2);	 Catch:{ IOException -> 0x00fa, all -> 0x00f5 }
        r0.<init>(r4);	 Catch:{ IOException -> 0x00fa, all -> 0x00f5 }
        r1 = 524288; // 0x80000 float:7.34684E-40 double:2.590327E-318;
        r1 = new byte[r1];	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r4 = java.lang.System.currentTimeMillis();	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
    L_0x0092:
        r6 = r3.read(r1);	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r7 = -1;
        if (r6 == r7) goto L_0x00df;
    L_0x0099:
        r7 = r14.d;	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r7 = r7.stop();	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        if (r7 == 0) goto L_0x00b5;
    L_0x00a1:
        r1 = c.h.a.m0.j.a;
        r3.close();	 Catch:{ IOException -> 0x00a6 }
    L_0x00a6:
        r0.close();	 Catch:{ IOException -> 0x00a9 }
    L_0x00a9:
        r0 = r14.d;
        r0 = r0.stop();
        if (r0 == 0) goto L_0x00b4;
    L_0x00b1:
        r2.delete();
    L_0x00b4:
        return;
    L_0x00b5:
        r7 = 0;
        r0.write(r1, r7, r6);	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r7 = r14.b;	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r9 = (long) r6;	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r7 = r7 + r9;
        r14.b = r7;	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r6 = java.lang.System.currentTimeMillis();	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r8 = r6 - r4;
        r10 = 1000; // 0x3e8 float:1.401E-42 double:4.94E-321;
        r12 = (r8 > r10 ? 1 : (r8 == r10 ? 0 : -1));
        if (r12 >= 0) goto L_0x00d3;
    L_0x00cb:
        r8 = r14.b;	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r10 = r14.a;	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r12 = (r8 > r10 ? 1 : (r8 == r10 ? 0 : -1));
        if (r12 != 0) goto L_0x0092;
    L_0x00d3:
        r4 = r14.d;	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r5 = new c.h.a.x.m;	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r5.m2163init(r14, r4);	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        c.h.a.m0.p.a.b(r5);	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r4 = r6;
        goto L_0x0092;
    L_0x00df:
        r0.flush();	 Catch:{ IOException -> 0x00fb, all -> 0x00f3 }
        r1 = c.h.a.m0.j.a;
        r3.close();	 Catch:{ IOException -> 0x00e7 }
    L_0x00e7:
        r0.close();	 Catch:{ IOException -> 0x00ea }
    L_0x00ea:
        r0 = r14.d;
        r0 = r0.stop();
        if (r0 == 0) goto L_0x012a;
    L_0x00f2:
        goto L_0x0127;
    L_0x00f3:
        r1 = move-exception;
        goto L_0x012f;
    L_0x00f5:
        r0 = move-exception;
        r13 = r1;
        r1 = r0;
        r0 = r13;
        goto L_0x012f;
    L_0x00fa:
        r0 = r1;
    L_0x00fb:
        r1 = r3;
        goto L_0x0103;
    L_0x00fd:
        r0 = move-exception;
        r3 = r1;
        r1 = r0;
        r0 = r3;
        goto L_0x012f;
    L_0x0102:
        r0 = r1;
    L_0x0103:
        r3 = r14.d;	 Catch:{ all -> 0x012b }
        r3.getClass();	 Catch:{ all -> 0x012b }
        r4 = new c.h.a.x.b;	 Catch:{ all -> 0x012b }
        r4.m2152init(r3);	 Catch:{ all -> 0x012b }
        c.h.a.m0.p.a.b(r4);	 Catch:{ all -> 0x012b }
        r2.delete();	 Catch:{ all -> 0x012b }
        r3 = c.h.a.m0.j.a;
        if (r1 == 0) goto L_0x011a;
    L_0x0117:
        r1.close();	 Catch:{ IOException -> 0x011a }
    L_0x011a:
        if (r0 == 0) goto L_0x011f;
    L_0x011c:
        r0.close();	 Catch:{ IOException -> 0x011f }
    L_0x011f:
        r0 = r14.d;
        r0 = r0.stop();
        if (r0 == 0) goto L_0x012a;
    L_0x0127:
        r2.delete();
    L_0x012a:
        return;
    L_0x012b:
        r3 = move-exception;
        r13 = r3;
        r3 = r1;
        r1 = r13;
    L_0x012f:
        r4 = c.h.a.m0.j.a;
        if (r3 == 0) goto L_0x0136;
    L_0x0133:
        r3.close();	 Catch:{ IOException -> 0x0136 }
    L_0x0136:
        if (r0 == 0) goto L_0x013b;
    L_0x0138:
        r0.close();	 Catch:{ IOException -> 0x013b }
    L_0x013b:
        r0 = r14.d;
        r0 = r0.stop();
        if (r0 == 0) goto L_0x0146;
    L_0x0143:
        r2.delete();
    L_0x0146:
        throw r1;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.h.a.x.q.run():void");
    }
}
